package com.colin.aiyi.presenter.Imp_de;

import com.colin.aiyi.ui.IViewAc;
import com.colin.aiyi.dao.ImpxUtils3_de.IService;
import com.colin.aiyi.dao.ImpxUtils3_de.ImpLogin;
import com.colin.aiyi.entity.response.LoginResponse;
import com.colin.aiyi.entity.User;
import com.colin.aiyi.presenter.Interface_Derecated.AbsPresenter;
import com.colin.aiyi.utils.SharePreferenceUtil;

/**
 * Created by hl on 2017/5/24.
 */
@Deprecated
public class ImpLoginP extends AbsPresenter<User> {
    IViewAc iViewAc;

    public ImpLoginP(IViewAc iViewAc) {
        this.iViewAc = iViewAc;
    }

    IService<User> iService= new ImpLogin();
    @Override
    public void onSuccess(Object t) {
        if (t instanceof LoginResponse)
        {
           sendMsgToView(t);
        }else {
            sendMsgToView(new LoginResponse());
        }
    }


    @Override
    public void getTByParameter(String... parameter) {
        super.getTByParameter(parameter);
        iService.getTByParameter(this,parameter);
    }


    @Override
    public void saveT(User user) {
        super.saveT(user);
        SharePreferenceUtil.saveObject(iViewAc.getContext(),user);
    }
}
